import java.sql.*;
public class Age {
    public static void main(String args[]) {
        Connection con=null;
        Statement sql;
        ResultSet rs;
        String uri = "jdbc:mysql://localhost:3306/world";
        String user ="root";
        String password ="";
        try{
            con = DriverManager.getConnection(uri,user,password);
        }
        catch(SQLException e){
            System.out.println(e);
        }
        try {
            if (con == null) return;
            sql=con.createStatement();
            String sqlStr = "select * from country order by LifeExpectancy";
            rs=sql.executeQuery(sqlStr);
            rs.first();
            String Name= rs.getString(2);
            float LifeExpectancy=rs.getFloat(8);
            System.out.printf("%s %f\n",Name,LifeExpectancy);
            rs.last();
            Name= rs.getString(2);
            LifeExpectancy=rs.getFloat(8);
            System.out.printf("%s %f",Name,LifeExpectancy);
            con.close();
        }
        catch(SQLException e) {
            System.out.println(e);
        }
    }
}